]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dbusServices/extensions: Handle parentWindow parameter
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 5 Mar 2020 16:19:38 +0000 (17:19 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 26 Mar 2020 17:32:30 +0000 (18:32 +0100)
Now that the service implements the preference dialog, it's time
to support OpenExtensionPrefs()'s parentWindow parameter and make
the dialog a transient of the external window if specified.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1087

js/dbusServices/extensions/extensionsService.js

index 48237384698158434bd3560f722b6004a116550f..9d444c5510814f9b896ba710f4db91d8555f72e3 100644 (file)
@@ -1,7 +1,7 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 /* exported ExtensionsService */
 
-const { Gdk, Gio, GLib, GObject, Gtk } = imports.gi;
+const { Gdk, Gio, GLib, GObject, Gtk, Shew } = imports.gi;
 
 const ExtensionUtils = imports.misc.extensionUtils;
 
@@ -110,7 +110,7 @@ var ExtensionsService = class extends ServiceImplementation {
     }
 
     OpenExtensionPrefsAsync(params, invocation) {
-        const [uuid, parentWindow_, options] = params;
+        const [uuid, parentWindow, options] = params;
 
         this._proxy.GetExtensionInfoRemote(uuid, (res, error) => {
             if (this._handleError(invocation, error))
@@ -120,6 +120,15 @@ var ExtensionsService = class extends ServiceImplementation {
             const extension = ExtensionUtils.deserializeExtension(serialized);
 
             const window = new ExtensionPrefsDialog(extension);
+            window.realize();
+
+            let externalWindow = null;
+
+            if (parentWindow)
+                externalWindow = Shew.ExternalWindow.new_from_handle(parentWindow);
+
+            if (externalWindow)
+                externalWindow.set_parent_of(window.window);
 
             if (options.modal)
                 window.modal = options.modal.get_boolean();